feat: HC-121 — dogfooding: the real Ontology examcalc package via IR v2#30
Merged
Conversation
First artifact of the adoption path: the hand-written examcalc
DomainOntologyPackage (Ontology repo, 13 classes / 8 relations /
4 policies / 7-state machine, 240 lines of YAML) modeled as
examcalc.{hc,hcs} and regenerated by a consumer-side adapter
(backend.py) from the emitted IR v2. CI compares the result
semantically against a verbatim copy of the original — it matched on
the first complete run.
- Kind defaults via selectors (.entity/.command/...) carry what the
YAML restates per entry; per-node rules hold only specifics.
- approvalStatus is a @stage context, not an edited field: approving
the package is a one-node hypercode diff.
- Contracts gate a document that previously had none (card_min >= 0,
required domain/range/text).
- All schema knowledge (envelope, key spelling, comma-joined list
encoding) stays in the adapter — Hypercode never learns the
ontology schema (DOCS/Backends.md rule, now demonstrated).
The honest finding: size parity for one package (201 vs 212
meaningful lines) — compression starts at the second package via an
@imported shared baseline. DOCS/Dogfooding.md starts the friction log
(F1 no list values, F2 single-typed contracts, F3 synthetic sibling
ids, F4 id-quoting noise, F5 flat property names); remaining HC-121
scope (ontologyc import step, Hyperprompt exercise) recorded in the
workplan.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Homebrew-managed system Python on macos-latest rejects 'pip install' into the global environment; a throwaway venv is the self-contained fix (no extra action dependency). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds the first “dogfooding” real-world artifact to the repo by modeling the Ontology repo’s examcalc DomainOntologyPackage as Hypercode (.hc + .hcs), emitting IR v2, and regenerating the original YAML via a consumer-side backend with a semantic equality check in CI.
Changes:
- Introduces
Examples/ontology-backend/(spec + backend adapter + expected YAML) to round-trip a real Ontology package through IR v2. - Adds a dogfooding friction log (
DOCS/Dogfooding.md) and updates the workplan to mark HC-121’s first artifact shipped. - Extends CI to run the ontology backend semantic check.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| workplan.md | Updates HC-121 status/description to reflect the shipped first artifact and remaining scope. |
| Examples/ontology-backend/README.md | Documents the runnable backend pipeline and what the example demonstrates. |
| Examples/ontology-backend/expected/domain-ontology-package.yaml | Adds the verbatim expected Ontology package YAML for semantic comparison. |
| Examples/ontology-backend/examcalc.hcs | Adds kind defaults, per-node rules, @stage context, and contracts for the examcalc package. |
| Examples/ontology-backend/examcalc.hc | Adds the examcalc package topology (nodes/relationships) used to emit IR v2. |
| Examples/ontology-backend/backend.py | Adds the consumer-side IR v2 → DomainOntologyPackage adapter and CI semantic comparer. |
| DOCS/Dogfooding.md | Adds the HC-121 dogfooding log entry with friction items (F1–F5). |
| .github/workflows/swift.yml | Adds a CI step to run the ontology backend --check comparison. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…in backend.py - subprocess decodes the emitted IR as UTF-8 explicitly (the example's Cyrillic source path must not depend on the process locale); - expected-YAML read and --out write are context-managed UTF-8; - duplicate or missing top-level package sections fail with a clear error instead of a silent dict overwrite and a confusing diff. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Residual-risk follow-up on #30: classes, relations, policies, state machines and fields now insert through a guard that fails with 'malformed package: duplicate <kind>' instead of silently overwriting the earlier entry and surfacing as a confusing semantic diff. (Top-level sections were already strict.) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First artifact of the dogfooding adoption path (stacked on #29) — the worked example of
DOCS/Backends.md, made runnable against a real document.The hand-written
examcalcDomainOntologyPackage from the Ontology repo (13 classes, 8 relations, 4 policies, a 7-state machine — 240 lines of YAML) is modeled asexamcalc.{hc,hcs}and regenerated by a consumer-side adapter from the emitted IR v2. CI compares the result semantically against a verbatim copy of the original:What the cascade buys on a real document:
.entity/.command/Relation/Policy) carry everything the YAML restates per entry;approvalStatusbecomes a@stagecontext — approving the package is a one-nodehypercode diff;explain-able to its rule.The honest part: size parity for a single package (201 vs 212 meaningful lines) — compression starts at the second package via an
@imported shared baseline (HC-116).DOCS/Dogfooding.mdstarts the friction log: F1 no list values in core (comma-joined strings), F2 single-typed contracts can't expressint | "*", F3 synthetic ids for same-type siblings, F4 id-selector quoting noise, F5 flat property names. These feed the M9 discussion.Remaining HC-121 scope (recorded in the workplan): the
import-hypercodestep insideontologycitself and the same exercise for a Hyperprompt configuration — both live in the consumer repos.Train complete: #27 (HC-116) → #28 (HC-114) → #29 (HC-120) → this.
🤖 Generated with Claude Code